import Taro from '@tarojs/taro'
import { getPlatform } from '@UTILS/common'
import Scenes from '@NAVIGATION/scenes'
import i18n from '@I18N'
export const H5_AUTHORIZE_BASE_URL = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${APP_ID}`

export const IMAGE_OSS_URL = 'https://careoss.p88health.com'
export const LANGUAGE = {
  ZH: 'zh',
  EN: 'en',
}

export const OSS_TYPE = {
  CareChat: 'CareChat',
  Consultation: 'Consultation',
  CareUser: 'CareUser',
  CaseHistory: 'CaseHistory',
}
export const ENV_TYPE = {
  ENV: 'dev'
}
export const LOGIN_FAILURE_MAP = ['usr.aut.utm', 'usr.aut.iut']
export const DISABLE_LOGIN_FAILURE_MAP = ['GET_FEEDS_FAILURE', 'GET_RECOMMEND_DOCTORS_FAILURE', 'GET_PROFILE_FAILURE']

export const CLIENT_TYPE_MAP = {
  [Taro.ENV_TYPE.RN]: 'app',
  [Taro.ENV_TYPE.WEB]: 'h5',
  [Taro.ENV_TYPE.WEAPP]: 'wmp',
}

export const ACQUIRE_CHANNEL = {
  [Taro.ENV_TYPE.RN]: 'app',
  [Taro.ENV_TYPE.WEB]: 'WEB',
  [Taro.ENV_TYPE.WEAPP]: 'WEAPP',
  DoctorQRCode: 'DoctorQRCode',
  SurveyPatientRegister: 'SurveyPatientRegister',
  PublicNumber: 'PublicNumber',
  DIAGNOSIS: 'Diagnosis',
  Offline: 'Offline',
  1035: 'PublicNumber',
  1008: 'GroupChat',
  1007: 'FriendSession',
  1058: 'OfficialAccountArticle',
  1154: 'Moments',
  1155: 'Moments',
  SpringRain: 'SpringRain'
}

export const SUB_CHANNEL = {
  InternationalConsultation: 'InternationalConsultation',
  Electronic: 'Electronic',
}
export const EMPTY_TYPE = {
  NoContent: 'NoContent',
  NoNetwork: 'NoNetwork',
  NoResult: 'NoResult',
}

export const LIST_PAGE_STATUS = {
  LOADING: 'LOADING',
  FINISH: 'FINISH',
  INITIAL: 'INITIAL'
}
export const DISPLAY_FREQUENCY_ENUM = {
  Once: 'Once',
  Every: 'Every'
}
export const WEB_NAV_HEIGHT = 50

export const webContainerStyle = getPlatform().isWeb ? { paddingTop: '50px' } : {}

export const HIDE_NAV_PAGE = [
  Scenes.myPage,
  Scenes.dataCenter,
  Scenes.expertPage,
  Scenes.jumpMpPage,
  Scenes.homePage,
  Scenes.videoDetail,
  Scenes.inviteDetail,
  Scenes.surveyDetail,
  Scenes.medRecordSurvey,
]

export const TAB_PAGE = [Scenes.homePage, Scenes.myPage, Scenes.dataCenter, Scenes.expertPage]

export const DECISION_PAGES = [
  Scenes.decisionFlowIndex,
  Scenes.decisionFlow,
  Scenes.decisionResultPage,
]

export const HIDDEN_FIXED_PAGES = [
  Scenes.jumpMpPage,
  Scenes.createPatient,
  Scenes.decisionFlowIndex,
  Scenes.decisionFlow,
  Scenes.decisionResultPage,
  Scenes.evaluationServicePack,
  Scenes.meditationDetail,
  Scenes.managePlan,
]

export const CLICK_HOME_BUTTON = '?isHomeFixedButton=true'

export const FIXED_PAGE = [
  Scenes.feedDetail,
  Scenes.createPainLog,
  Scenes.createPatient,
  Scenes.orderDetail,
  Scenes.consultationDetail,
  Scenes.planReportDetail,
]

export const NAV_BG_COLOR_PAGE = {
  [Scenes.orderDetail]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.servicePackOrderDetail]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.planOrderDetail]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.myVipServiceRights]: { bgColor: '#fae5dc', isWhite: false },
  [Scenes.patientRegistration]: { bgColor: '#47C690', isWhite: true },
  [Scenes.groupProfile]: { bgColor: '#47C690', isWhite: true },
  [Scenes.managePlan]: { bgColor: '#FFFFFF', isWhite: false },
  [Scenes.smartAssistant]: { bgColor: '#DEF6FF', isWhite: false },
  [Scenes.planReportDetail]: { bgColor: '#D7F7F2', isWhite: false },
  [Scenes.decisionResultPage]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.decisionList]: { bgColor: '#EAF7F2', isWhite: false },
  [Scenes.decisionFlowIndex]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.patientRegistrationSuccess]: { bgColor: '#EBF8F3', isWhite: false },
  [Scenes.createLogPatient]: { bgColor: '#F7FFF9', isWhite: false },
  [Scenes.selectLogPatient]: { bgColor: '#F7FFF9', isWhite: false },
}

export const ROUTER_ID_MAP = {
  [Scenes.feedDetail]: 'id',
  [Scenes.videoDetail]: 'id',
  [Scenes.doctorDetail]: 'pId',
  [Scenes.decisionFlowIndex]: 'dId',
  [Scenes.patientRegistration]: 'p8Id',
  [Scenes.servicePack]: 'code'
}

export const TEXT_MAP = {
  [LIST_PAGE_STATUS.INITIAL]: i18n.common.list_loading(),
  [LIST_PAGE_STATUS.LOADING]: i18n.common.list_loading(),
  [LIST_PAGE_STATUS.FINISH]: i18n.common.list_finish(),
}

export enum REDUX_TYPE_ENUM {
  REQUEST = 'REQUEST',
  SUCCESS = 'SUCCESS',
  FAILURE = 'FAILURE',
}

export const FIVE_MINUTES = 5 * 60 * 1000
export enum SHARE_TYPE {
  WeChatMoment = 'WeChatMoment',
  WeChatFriend = 'WeChatFriend'
}

export enum ROUTER_SCENE_TITLE {
  homePage = '首页',
  dataCenter = '头痛日志Tab页',
  expertPage = '专家百科Tab',
  managePlan = '管理计划详情页',
  meditation = '冥想列表页',
  meditationDetail = '冥想详情页',
  tagDetail = '常见疼痛详情页',
  doctorDetail = '医生主页',
  decisionFlowIndex = '自测详情页',
  feedDetail = '文章详情页',
  videoDetail = '视频详情页',
  planReportDetail = '计划报告详情页',
  inviteDetail = '活动详情页',
  internationalConsultation = '国际远程会诊',
  createPainLog = '创建日志',
}

export enum SHARE_ROUTE_TYPE {
  invite='invite'
}

export const EVENT_DIALOG_DATA = {
  Type: {
    ImportLog: '确认导入日志',
    ChangeSite: '确认更改部位',
    MedRecord: '病历资料tab',
    MedRecordSubmit: '电子病历提交',
    MedRecordFollowUpSubmit: '复诊电子病历提交',
    CancelPlan: '管理计划取消订单',
    CancelConsultation: '图文咨询取消订单',
    CancelPhoneConsultation: '电话咨询取消订单',
  },
  Page: {
    createPainLog: '疼痛日志填写页',
    createLogPatient: '首次创建患者页',
    selectLogPatient: '选择患者页',
    patientDetail: '健康档案页',
    searchResult: '全局搜索',
  }
}
